package 力扣._3216_交换后字典序最小的字符串;

class Solution {
    public String getSmallestString(String s) {
        char[] chars = s.toCharArray();
        int len = chars.length;
        for (int i = 0; i < len-1; i++) {
            if(chars[i]>chars[i+1] && chars[i]%2==chars[i+1]%2){
                int j = i+1;
                char temp = chars[i];
                chars[i] = chars[j];
                chars[j] = temp;
                break;
            }
        }
        return new String(chars);
    }
}